package com.igeek.boot.service;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.igeek.boot.entity.Orders;
import com.igeek.boot.entity.Ordersetting;
import com.igeek.boot.mapper.OrdersMapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.igeek.boot.mapper.OrdersettingMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.time.LocalDate;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author author
 * @since 2024-08-23
 */
@DS("orders")
@Service
public class OrdersServiceImpl extends ServiceImpl<OrdersMapper, Orders> implements OrdersService {

    @Autowired
    private OrdersMapper ordersMapper;

    @Override
    //若在执行当前方法时有事务正在工作，将这个外部事务进行挂起，只运行本方法内部的事务
    @Transactional(propagation = Propagation.REQUIRES_NEW)
    public boolean submitOrder(Orders order) {
        //1.插入预约信息
        int row1 = ordersMapper.insert(order);
        return row1>0;
    }
}
